<% title "Projects" %>

<div id="projects" class="span-18">
  <% for project in @projects %>
    <div class="project_list span-18">
      <h1><%= link_to project.title, edit_admin_project_url(project) %></h1>
      <p class="location"><%= project.location %></p>
      <div class="span-4">
        <dl>
          <dt>Started On</dt>
          <dd><%= project.started_on.to_s(:long) %></dd>
          <dd><%= project.percent_done %> completed</dd>

          <% unless project.completed_on.blank? %>
            <dt>Completed On:</dt>
            <dd><%= project.completed_on.to_s(:long) %></dd>
          <% end %>
        
          <% unless project.sub_contractors.blank? %>
            <dt>Subs</dt>
            <% project.sub_contractors.each do |s| %>
              <dd><%= s.name %></dd>
            <% end %>
          <% end %>
        </dl>
      </div>

      <div class="span-13 last description">
        <%= truncate project.description_html, :length => 300 %>
      </div>

      <div class="span-18">
        <h4>Tags</h4>
        <% project.tags.each do |tag| %>
          <span class="tag"><%= tag.name %></span>
        <% end %>
      </div>
    </div>
  <% end %>
</div>

<div id="links" class="span-6 last">
  <div id="new_project">
    <% form_for Project.new, :url => admin_projects_url do |f| %>
      <div class="form_pair">
        <%= f.label :title %>
        <%= f.text_field :title %>
      </div>
      <div class="form_pair">
        <%= f.hidden_field :started_on, :value => Time.now %>
        <%= f.submit "Create New Project" %>
      </div>
    <% end %>
  </div>
</div>






